/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mowa.biblioteca.dao.hibernate;

import com.mowa.biblioteca.dao.AutorDao;
import com.mowa.biblioteca.model.Autor;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

/**
 *
 * @author Osamu
 */
@Component
public class AutorDaoHibernate extends HibernateDaoSupport implements AutorDao  {

    @Autowired
    public AutorDaoHibernate(SessionFactory  sessionFactory) {
        setSessionFactory(sessionFactory);
    }
    @Override
    public List<Autor> obtenerListaAutor() {
        StringBuilder query = new StringBuilder("from Autor a ");
        List list = getHibernateTemplate().find(query.toString());
        return list;
    }

}
